// https://leetcode.cn/problems/he-wei-sde-liang-ge-shu-zi-lcof/description/


class Solution {
public:
    vector<int> twoSum(vector<int>& price, int target) {
        sort(price.begin(), price.end());
        int l = 0, r = price.size() - 1;
        while(l < r) {
            if(price[l] + price[r] > target) {
                r--;
            }else if(price[l] + price[r] < target){
                l++;
            }else {
                return {price[l], price[r]};
            }
        }
        return {-1, -1};
    }
};